<template>
    <Layout>
        <Form ref="form1" :model="dataToQuery" :label-width="120">
            <div v-if="!modelSearch">
                <Row class="query-form">
                    <Col span="8">
                        <FormItem label='二级集团：' prop='belongOrgId'>
                            <Select class='query-form-el' placeholder="集团名称"  v-model='dataToQuery.belongOrgId'>
                                <Option v-for="item in twoLevel" :value="item.orgId" :key="item.orgId">{{item.orgName}}</Option>
                            </Select>
                        </FormItem>
                    </Col>
                    <Col span="8">
                        <FormItem label="单位名称：" prop="order">
                            <company-select v-model="dataToQuery.companyName" style="width:100%" />
                            <!-- <cascader-dom class="query-form-el" ref='queryOrgCascader' @setOrgname='setQueryOrgName' :orgTree="true"
                                          :setCurrentName="{label:dataToQuery.companyName,value:dataToQuery.companyId}"></cascader-dom> -->
                        </FormItem>
                    </Col>
                    <Col span="8" v-if="!switchFlag">
                        <Button @click="switchQuery(true,88)" class="ivu-btn-switch" type="text">展开∨</Button>
                        <Button @click="reset" class="ivu-btn-reset">重置</Button>
                        <Button type="primary" class="ivu-btn-query" icon="md-search" @click="query">查询</Button>
                    </Col>
                    <Col span="8" v-else>
                        <FormItem label='开始时间：' prop='startTime'>
                            <DatePicker class="query-form-el" v-model="dataToQuery.startTimeRange" format="yyyy-MM-dd" type="daterange" placement="bottom-end" placeholder="请选择检查时间段"
                                        @on-change="(date) => onSelectFieldQueryDateRange(date, 'startTime')"	></DatePicker>
                        </FormItem>
                    </Col>
                </Row>
                <Row v-show="switchFlag" class="query-form">
                    <Col span="8">
                        <FormItem label='涉及危险作业：' prop='ifHazardousWork'>
                            <Select v-model='dataToQuery.ifHazardousWork' clearable class='query-form-el'>
                                <Option value="是">是</Option>
                                <Option value="否">否</Option>
                            </Select>
                        </FormItem>
                    </Col>
                    <Col span="8">
                        <FormItem label='是否驻场：' prop='ifResident'>
                            <Select v-model='dataToQuery.ifResident' clearable class='query-form-el'>
                                <Option value="是">是</Option>
                                <Option value="否">否</Option>
                            </Select>
                        </FormItem>
                    </Col>
                    <Col span="8">
                        <FormItem label='作业状态：' prop='workStatus'>
                            <Select v-model='dataToQuery.workStatus' clearable class='query-form-el'>
                                <Option value="3">计划中</Option>
                                <Option value="0">进行中</Option>
                                <Option value="1">已完成</Option>
                                <Option value="2">延期完成</Option>
                            </Select>
                        </FormItem>
                    </Col>
                </Row>
                <Row v-show="switchFlag" class="query-form">
                    <Col span="8">
                        <FormItem label='是否清库：' prop='ifConcreteClean'>
                            <Select v-model='dataToQuery.ifConcreteClean' clearable placeholder="请选择是否清库" class='query-form-el'>
                                <Option value="是">是</Option>
                                <Option value="否">否</Option>
                            </Select>
                        </FormItem>
                    </Col>
					<Col span="8">
					    <FormItem label='是否涉及监理单位：' prop='ifSupervisor'>
					        <Select v-model='dataToQuery.ifSupervisor' placeholder="请选择是否涉及监理单位"  class='query-form-el'>
					            <Option value="是">是</Option>
					            <Option value="否">否</Option>
					        </Select>
					    </FormItem>
					</Col>
                    <Col span="8">
                        <Button @click="switchQuery(false,88)" class="ivu-btn-switch" type="text">收起∧</Button>
                        <Button @click="reset" class="ivu-btn-reset">重置</Button>
                        <Button class="ivu-btn-query" icon="md-search" @click="query">查询</Button>
                    </Col>
                </Row>
                <Row class="query-form">
                    <Col span="24">
                        <Button size="large" class="ivu-btn-add" icon="md-add" @click="addInfo">新增</Button>
                        <!-- <Button type="primary" class="ivu-btn-add" icon="md-cloud-download" @click="exportFormSubmit">导出</Button> -->
                        <download-button :api="exportUrl" :queryForm="dataToQuery" />
                    </Col>
                </Row>
            </div>
            <div v-else>
                <Row class="query-form">
                    <Col span="8">
                        <FormItem label='相关方名称：' prop='ifHazardousWork'>
                            <Input class='query-form-el' type='text' v-model='dataToQuery.relatedPartiesName'></Input>
                        </FormItem>
                    </Col>
                    <Col span="8">
                        <FormItem label='是否住场：' prop='ifResident'>
                            <Select v-model='dataToQuery.ifResident' clearable class='query-form-el'>
                                <Option value="是">是</Option>
                                <Option value="否">否</Option>
                            </Select>
                        </FormItem>
                    </Col>
                    <Col span="8" v-if="!switchFlag">
                        <Button @click="switchQuery(true)" class="ivu-btn-switch" type="text">展开∨</Button>
                        <Button @click="reset" class="ivu-btn-reset">重置</Button>
                        <Button type="primary" class="ivu-btn-query" icon="md-search" @click="query">查询</Button>
                    </Col>
                    <Col span="8" v-else>
                        <FormItem label='开始时间：' prop='startTime'>
                            <DatePicker class="query-form-el" v-model="dataToQuery.startTimeRange" format="yyyy-MM-dd" type="daterange" placement="bottom-end" placeholder="请选择检查时间段"
                                        @on-change="(date) => onSelectFieldQueryDateRange(date, 'startTime')"	></DatePicker>
                        </FormItem>
                    </Col>
                </Row>
                <Row v-show="switchFlag" class="query-form">
                    <Col span="8">
                        <FormItem label='是否涉及危险作业：' prop='ifHazardousWork'>
                            <Select v-model='dataToQuery.ifHazardousWork' clearable class='query-form-el'>
                                <Option value="是">是</Option>
                                <Option value="否">否</Option>
                            </Select>
                        </FormItem>
                    </Col>
                    <Col span="8">
                        <FormItem label='作业状态：' prop='workStatus'>
                            <Select v-model='dataToQuery.workStatus' clearable class='query-form-el'>
                                <Option value="3">计划中</Option>
                                <Option value="0">进行中</Option>
                                <Option value="1">已完成</Option>
                                <Option value="2">延期完成</Option>
                            </Select>
                        </FormItem>
                    </Col>
                    <Col span="8">
                        <Button @click="switchQuery(false)" class="ivu-btn-switch" type="text">收起∧</Button>
                        <Button @click="reset" class="ivu-btn-reset">重置</Button>
                        <Button class="ivu-btn-query" icon="md-search" @click="query">查询</Button>
                    </Col>
                </Row>
            </div>
        </Form>
        <Table ref='table' :height="tableHeight" no-data-text="没有查询到相关数据!" 
        @on-sort-change="sortChange" :show-summary="!this.modelSearch" :summary-method="(data) => this.gAmountTo(data,['workLicenseNumber','workerNumber'])" 
        @on-selection-change='getSelectRows' :loading='pageStatus.loading' border :columns="columns1" :data="!this.modelSearch?dataTable:dataTable.filter(i=>i.id != '-1')">
        </Table>
        <Row style="margin-right:10px;">
            <Col span="24">
                <Page style="float: right" :total="pagedata.total" :page-size="pagedata.pageSize" @on-change="pageChange" @on-page-size-change="pageSizeChange" :page-size-opts="pageSizeArray" show-total show-sizer show-elevator/>
            </Col>
        </Row>
        <Modal :title="this.getModalTitle('相关方作业信息')" :transfer=false :mask-closable="false" v-model="dialogShow" v-if="dataToView && dialogShow" :width=800 class-name='limit-height-dialog'>
            <Row>
                <Col span="24">
                    <Form ref="dialogForm" :class="mode === 'view'?'modal-view-detail':''" :show-message="false" :model="dataToView" :rules="mode === 'view'?{}:ruleCustom" :label-width="mode === 'view'?160:null" :label-position="mode === 'view'?'right':'top'">
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="23">
                                <FormItem label='所属二级集团：' prop='belongOrgId'>
                                    <div v-if="mode === 'view'">{{ dataToView.belongOrgName }}</div>
                                    <!--<Input v-else class='query-form-el' placeholder="请填写所属二级集团" type='text' v-model='dataToView.belongOrgId'></Input>-->
                                    <Select v-else class='query-form-el' placeholder="集团名称"  v-model='dataToView.belongOrgId' label-in-value @on-change="belongChange">
                                        <Option v-for="item in twoLevel" :value="item.orgId" :key="item.orgId">{{item.orgName}}</Option>
                                    </Select>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label='单位名称：' prop='companyId'>
                                    <div v-if="mode === 'view'">{{ dataToView.companyName }}</div>
                                    <div v-else>
                                        <cascader-dom  v-if="show"  class='query-form-el' ref='orgCascader' @setOrgInfo='setCompanyId' @setOrgname="setCompanyName" :orgTree="true"
                                                       :currentOrgId="dataToView.companyId" :rootOrgId="dataToView.belongOrgId"
                                                       :setCurrentName="{label:dataToView.companyName,value:dataToView.companyId}" ></cascader-dom>
                                    </div>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label='相关方名称：' prop='relatedPartiesId'>
                                    <div v-if="mode === 'view'">{{ dataToView.relatedPartiesName }}</div>
                                    <Input v-else class='query-form-el' placeholder="请填写相关方名称" type='text' readonly
                                           @on-focus="relatedPartiesModel=true" v-model='dataToView.relatedPartiesName'></Input>
                                </FormItem>
                            </Col>
                        </Row>
												<Row type="flex" justify="space-around" class="code-row-bg">
												    <Col span='11'>
												        <FormItem label='相关方负责人：' prop="constructionDirector">
												          <div v-if="mode === 'view'">{{dataToView.constructionDirector}}</div>
												          <Input v-else class='' placeholder="请填写相关方负责人" type='text' v-model='dataToView.constructionDirector'></Input>
												        </FormItem>
												    </Col>
												    <Col span='11' >
												        <FormItem label='相关方负责人电话：' prop="constructionDirectorPhone">
												          <div v-if="mode === 'view'">{{dataToView.constructionDirectorPhone}}</div>
												          <Input v-else class='' placeholder="请填写相关方负责人电话" type='text' v-model='dataToView.constructionDirectorPhone'></Input>
												        </FormItem>
												    </Col>
												</Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label='是否清库：' prop='ifConcreteClean'>
                                    <div v-if="mode === 'view'">{{ dataToView.ifConcreteClean }}</div>
                                    <!--<Input v-else class='query-form-el' placeholder="请填写第三方驻地是否租赁" type='text' v-model='dataToView.ifLease'></Input>-->
                                    <Select v-else v-model='dataToView.ifConcreteClean' placeholder="请选择是否清库"
                                            @on-change="(val)=>{if (dataToView.ifConcreteClean=='是'){dataToView.workingMatters='清库作业',dataToView.storageMount =1}}" class='query-form-el'>
                                        <Option value="是">是</Option>
                                        <Option value="否">否</Option>
                                    </Select>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label='作业事项：' prop='workingMatters'>
                                    <div v-if="mode === 'view'">{{ dataToView.workingMatters }}</div>
                                    <Input v-else class='query-form-el' placeholder="请填写作业事项" type='text' show-word-limit maxlength="200"
                                           :disabled="dataToView.ifConcreteClean=='是'" v-model='dataToView.workingMatters'></Input>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg" v-if="dataToView.ifConcreteClean=='是'">
                            <Col span="11">
                                <FormItem label='清库方式：' prop='cleanMethod'>
                                    <div v-if="mode === 'view'">{{this.cleanMethodList[dataToView.cleanMethod] && this.cleanMethodList[dataToView.cleanMethod].codingName}}</div>
                                    <Select v-else class='' placeholder="请选择类别" type='text' v-model='dataToView.cleanMethod' >
                                        <Option v-for="item in dictMap.cleanMethodList" :value="item.codingCodeId" :key="item.codingCodeId">{{ item.codingName }}</Option>
                                    </Select>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label='储库数量：' prop='storageMount'>
                                    <div v-if="mode === 'view'">{{dataToView.storageMount}}</div>
                                    <InputNumber v-else class="w" :min="0"  type='text' v-model='dataToView.storageMount'></InputNumber>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg" v-if="dataToView.ifConcreteClean=='是'">
                            <Col span="23">
                                <FormItem label='清理储库名称：' prop='storageName'>
                                    <div v-if="mode === 'view'">{{dataToView.storageName}}</div>
                                    <Input v-else class='' placeholder="请填写清理储库名称" type='text' show-word-limit maxlength="200" v-model='dataToView.storageName'></Input>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label='业务主管部门：' prop='businessCompetentDepartment'>
                                    <div v-if="mode === 'view'">{{ dataToView.businessCompetentDepartment }}</div>
                                    <Input v-else class='query-form-el' placeholder="请填写业务主管部门" type='text' v-model='dataToView.businessCompetentDepartment'></Input>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label='业务主管部门责任人：' prop='businessCompetentDepartmentUser'>
                                    <div v-if="mode === 'view'">{{ dataToView.businessCompetentDepartmentUser }}</div>
                                    <Input v-else class='query-form-el' placeholder="请填写业务主管部门责任人" type='text' v-model='dataToView.businessCompetentDepartmentUser'></Input>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label='安全环保监督部门责任人：' prop='supervisionDepartmentUser'>
                                    <div v-if="mode === 'view'">{{ dataToView.supervisionDepartmentUser }}</div>
                                    <Input v-else class='query-form-el' placeholder="请填写安全环保监督部门责任人" type='text' v-model='dataToView.supervisionDepartmentUser'></Input>
                                </FormItem>
                            </Col>
														<Col span="11">
														   <!-- <FormItem label='安全环保监督部门：' prop='supervisionDepartment'>
														        <div v-if="mode === 'view'">{{ dataToView.supervisionDepartment }}</div>
														        <Input v-else class='query-form-el' placeholder="请填写安全环保监督部门" type='text' v-model='dataToView.supervisionDepartment'></Input>
														    </FormItem> -->
														</Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label='属地主管部门：' prop='territorialCompetentDepartment'>
                                    <div v-if="mode === 'view'">{{ dataToView.territorialCompetentDepartment }}</div>
                                    <Input v-else class='query-form-el' placeholder="请填写属地主管部门" type='text' v-model='dataToView.territorialCompetentDepartment'></Input>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label='属地主管部门责任人：' prop='territorialCompetentDepartmentUser'>
                                    <div v-if="mode === 'view'">{{ dataToView.territorialCompetentDepartmentUser }}</div>
                                    <Input v-else class='query-form-el' placeholder="请填写属地主管部门责任人" type='text' v-model='dataToView.territorialCompetentDepartmentUser'></Input>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label='资质审核部门：' prop='qualificationReviewDepartment'>
                                    <div v-if="mode === 'view'">{{ dataToView.qualificationReviewDepartment }}</div>
                                    <Input v-else class='query-form-el' placeholder="请填写资质审核部门" type='text' v-model='dataToView.qualificationReviewDepartment'></Input>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label='资质审核部门责任人：' prop='qualificationReviewDepartmentUser'>
                                    <div v-if="mode === 'view'">{{ dataToView.qualificationReviewDepartmentUser }}</div>
                                    <Input v-else class='query-form-el' placeholder="请填写资质审核部门责任人" type='text' v-model='dataToView.qualificationReviewDepartmentUser'></Input>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label='开始时间：' prop='startTime'>
                                    <div v-if="mode === 'view'">{{renderViewDate( dataToView.startTime) }}</div>
                                    <DatePicker v-else class="query-form-el" placeholder="请选择开始时间" v-model='dataToView.startTime' :clearable="false"
                                                :options="{disabledDate(date) {return date && dataToView.playEndTime && date.valueOf() > dataToView.playEndTime;}}"></DatePicker>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label='计划结束时间：' prop='playEndTime'>
                                    <div v-if="mode === 'view'">{{renderViewDate( dataToView.playEndTime) }}</div>
                                    <DatePicker v-else class="query-form-el" placeholder="请选择计划结束时间" v-model='dataToView.playEndTime' :clearable="false"
                                                :options="{disabledDate(date) {return date && dataToView.startTime && date.valueOf() < dataToView.startTime;}}"></DatePicker>
                                </FormItem>
                            </Col>
                        </Row>
												<Row type="flex" justify="space-around" class="code-row-bg">
												    <Col span="11">
												        <FormItem label='特种作业人员上岗证数量：' prop='workLicenseNumber'>
												            <div v-if="mode === 'view'">{{ dataToView.workLicenseNumber }}</div>
												            <InputNumber v-else class='query-form-el' placeholder="请填写特种作业人员上岗证数量" :min='0' v-model='dataToView.workLicenseNumber'></InputNumber>
												        </FormItem>
												    </Col>
												    <Col span="11">
												        <FormItem label='特种作业人员数量：' prop='workerNumber'>
												            <div v-if="mode === 'view'">{{ dataToView.workerNumber }}</div>
												            <InputNumber v-else class='query-form-el' placeholder="请填写特种作业人员数量" :min='0' v-model='dataToView.workerNumber'></InputNumber>
												        </FormItem>
												    </Col>
												</Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label='是否涉及危险作业：' prop='ifHazardousWork'>
                                    <div v-if="mode === 'view'">{{ dataToView.ifHazardousWork }}</div>
                                    <!--<Input v-else class='query-form-el' placeholder="请填写是否涉及危险作业" type='text' v-model='dataToView.ifHazardousWork'></Input>-->
                                    <Select v-else v-model='dataToView.ifHazardousWork' placeholder="请选择是否涉及危险作业" class='query-form-el'
                                            @on-change="(value) => { if (value=='否'){dataToView.hazardousWorkItemArr=[],dataToView.hazardousWorkItems=null} }" >
                                        <Option value="是">是</Option>
                                        <Option value="否">否</Option>
                                    </Select>
                                </FormItem>
                            </Col>
                            <Col span="11" v-if="dataToView.ifHazardousWork==='是'">
                                <FormItem label='危险作业项目：' prop='hazardousWorkItemArr'>
                                    <div v-if="mode === 'view'">{{ dataToView.hazardousWorkItemName }}</div>
                                    <Select v-else v-model='dataToView.hazardousWorkItemArr' multiple placeholder="请选择危险作业项目" :max-tag-count="2" class='query-form-el'>
                                        <Option v-for="item in dictMap.hazardousWorkItems" :value="item.codingCodeId"
                                                :key="item.codingCodeId">{{item.codingName }}
                                        </Option>
                                    </Select>
                                </FormItem>
                            </Col>
                            <Col span="11" v-else></Col>
                        </Row>
                        <Row v-if="dataToView.ifHazardousWork==='是'" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="23">
                                <FormItem v-if="mode === 'view'" label="危险作业相关资质附件：">
                                    <div v-show="dataToView.idFiles.filter(t=>t.field==='1').length>0" v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='1')">
                                        <a @click="downloadFiles(item,index)"><span style="color: #3399ff;margin-left: 5px">{{ item.fileName }}</span></a>
                                        <Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>
                                    </div>
                                </FormItem>
                                <FormItem v-else label="危险作业相关资质附件：" prop="idFiles">
                                    <div>
                                        <Upload ref="upload"
                                                :before-upload="(file) => { beforeUpload1(file, 'id', 'workingRelatedRarties/1') }"
                                                :show-upload-list="true"
                                                :max-size="10240"
                                                multiple
                                                type="drag"
                                                :action="fileUrl">
                                            <div style="padding: 10px">
                                                <Icon type="ios-cloud-upload" size="45" style="color: #3399ff"></Icon>
                                                <p>点击将文件拖拽到这里上传</p>
                                            </div>
                                        </Upload>
                                    </div>
                                    <div v-show="dataToView.idFiles.filter(t=>t.field==='1').length>0" v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='1')" :key='item'>
                                        <a @click="downloadFiles(item,index)">{{ item.fileName }}</a>
                                        <Button type="text" icon="md-trash" @click="removeFile1(item.id, 'id', 'workingRelatedRarties/1')" style="margin-left: 5px;margin-bottom: 3px"/>
                                        <Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>
                                        <!--<Progress  v-show="filePercentVisible[index]" :percent="filePercent[index]"></Progress>-->
                                    </div>
                                </FormItem>
                            </Col>
                        </Row>

                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label='是否涉及监理单位：' prop='ifSupervisor'>
                                    <div v-if="mode === 'view'">{{ dataToView.ifSupervisor }}</div>
                                    <Select v-else v-model='dataToView.ifSupervisor' placeholder="请选择是否涉及监理单位"  class='query-form-el'
                                            @on-change="(value) => { if (value=='否'){dataToView.supervisorName=null} }">
                                        <Option value="是">是</Option>
                                        <Option value="否">否</Option>
                                    </Select>
                                </FormItem>
                            </Col>
                            <Col span="11" v-if="dataToView.ifSupervisor==='是'">
                                <FormItem label='监理单位名称：' prop='supervisorName'>
                                    <div v-if="mode === 'view'">{{ dataToView.supervisorName }}</div>
                                    <Input v-else class='query-form-el' placeholder="请填写监理单位名称" type='text' v-model='dataToView.supervisorName'></Input>
                                </FormItem>
                            </Col>
                            <Col span="11" v-else></Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label='是否住场：' prop='ifResident'>
                                    <div v-if="mode === 'view'">{{ dataToView.ifResident }}</div>
                                    <Select v-else v-model='dataToView.ifResident' placeholder="请选择是否住场"  class='query-form-el'
                                            @on-change="(value) => { if (value=='否'){dataToView.ifApprove=null} }">
                                        <Option value="是">是</Option>
                                        <Option value="否">否</Option>
                                    </Select>
                                </FormItem>
                            </Col>
                            <Col span="11" v-if="dataToView.ifResident==='是'">
                                <FormItem label='是否企业已审批：' prop='ifApprove'>
                                    <div v-if="mode === 'view'">{{ dataToView.ifApprove==0?'未审批':dataToView.ifApprove==1?'审批中':dataToView.ifApprove==2?'已审批':'' }}</div>
                                    <!--<Input v-else class='query-form-el' placeholder="请填写是否企业已审批" type='text' v-model='dataToView.ifApprove'></Input>-->
                                    <Select v-else v-model='dataToView.ifApprove' placeholder="请选择是否企业已审批"  class='query-form-el'>
                                        <Option value="0">未审批</Option>
                                        <Option value="1">审批中</Option>
                                        <Option value="2">已审批</Option>
                                    </Select>
                                </FormItem>
                            </Col>
                            <Col span="11" v-else></Col>
                        </Row>
                        <Row v-if="dataToView.ifApprove==='2'" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="23">
                                <FormItem v-if="mode === 'view'" label="审批资料：">
                                    <div v-show="dataToView.idFiles.filter(t=>t.field==='2').length>0" v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='2')">
                                        <a @click="downloadFiles(item,index)"><span style="color: #3399ff;margin-left: 5px">{{ item.fileName }}</span></a>
                                        <Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>
                                    </div>
                                </FormItem>
                                <FormItem v-else label="审批资料：" prop="idFiles">
                                    <div>
                                        <Upload ref="upload"
                                                :before-upload="(file) => { beforeUpload1(file, 'id', 'workingRelatedRarties/2') }"
                                                :show-upload-list="true"
                                                :max-size="10240"
                                                multiple
                                                type="drag"
                                                :action="fileUrl">
                                            <div style="padding: 10px">
                                                <Icon type="ios-cloud-upload" size="45" style="color: #3399ff"></Icon>
                                                <p>点击将文件拖拽到这里上传</p>
                                                <!--<span style="font-size:8px;color: #797a64">支持扩展名：.rar .zip .doc .docx .pdf...</span>-->
                                            </div>
                                        </Upload>
                                    </div>
                                    <div v-show="dataToView.idFiles.filter(t=>t.field==='2').length>0" v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='2')" :key='item'>
                                        <a @click="downloadFiles(item,index)">{{ item.fileName }}</a>
                                        <Button type="text" icon="md-trash" @click="removeFile1(item.id, 'id', 'workingRelatedRarties/2')" style="margin-left: 5px;margin-bottom: 3px"/>
                                        <Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>
                                        <!--<Progress  v-show="filePercentVisible[index]" :percent="filePercent[index]"></Progress>-->
                                    </div>
                                </FormItem>
                            </Col>
                        </Row>
												
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label='相关方日常检查是否纳入管理范围：' prop='ifBringControl'>
                                    <div v-if="mode === 'view'">{{ dataToView.ifBringControl }}</div>
                                    <Select v-else v-model='dataToView.ifBringControl' placeholder="请选择相关方日常检查是否纳入管理范围"  class='query-form-el'>
                                        <Option value="是">是</Option>
                                        <Option value="否">否</Option>
                                    </Select>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label='是否参加属地班组安全例会：' prop='ifJoinMeeting'>
                                    <div v-if="mode === 'view'">{{ dataToView.ifJoinMeeting }}</div>
                                    <!--<Input v-else class='query-form-el' placeholder="请填写是否参加属地班组安全例会" type='text' v-model='dataToView.ifJoinMeeting'></Input>-->
                                    <Select v-else v-model='dataToView.ifJoinMeeting' placeholder="请选择是否参加属地班组安全例会"  class='query-form-el'>
                                        <Option value="是">是</Option>
                                        <Option value="否">否</Option>
                                    </Select>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row v-if="dataToView.ifBringControl==='是'" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="23">
                                <FormItem v-if="mode === 'view'" label="相关方日常检查：">
                                    <div v-show="dataToView.idFiles.filter(t=>t.field==='3').length>0" v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='3')">
                                        <a @click="downloadFiles(item,index)"><span style="color: #3399ff;margin-left: 5px">{{ item.fileName }}</span></a>
                                        <Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>
                                    </div>
                                </FormItem>
                                <FormItem v-else label="相关方日常检查：" prop="idFiles">
                                    <div>
                                        <Upload ref="upload"
                                                :before-upload="(file) => { beforeUpload1(file, 'id', 'workingRelatedRarties/3') }"
                                                :show-upload-list="true"
                                                :max-size="10240"
                                                multiple
                                                type="drag"
                                                :action="fileUrl">
                                            <div style="padding: 10px">
                                                <Icon type="ios-cloud-upload" size="45" style="color: #3399ff"></Icon>
                                                <p>点击将文件拖拽到这里上传</p>
                                                <!--<span style="font-size:8px;color: #797a64">支持扩展名：.rar .zip .doc .docx .pdf...</span>-->
                                            </div>
                                        </Upload>
                                    </div>
                                    <div v-show="dataToView.idFiles.filter(t=>t.field==='3').length>0" v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='3')" :key='item'>
                                        <a @click="downloadFiles(item,index)">{{ item.fileName }}</a>
                                        <Button type="text" icon="md-trash" @click="removeFile1(item.id, 'id', 'workingRelatedRarties/3')" style="margin-left: 5px;margin-bottom: 3px"/>
                                        <Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>
                                        <!--<Progress  v-show="filePercentVisible[index]" :percent="filePercent[index]"></Progress>-->
                                    </div>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row v-if="dataToView.ifJoinMeeting==='是'" type="flex" justify="space-around" class="code-row-bg">
                            <Col span="23">
                                <FormItem v-if="mode === 'view'" label="班前会议相关资料：">
                                    <div v-show="dataToView.idFiles.filter(t=>t.field==='4').length>0" v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='4')">
                                        <a @click="downloadFiles(item,index)"><span style="color: #3399ff;margin-left: 5px">{{ item.fileName }}</span></a>
                                        <Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>
                                    </div>
                                </FormItem>
                                <FormItem v-else label="班前会议相关资料：" prop="idFiles">
                                    <div>
                                        <Upload ref="upload"
                                                :before-upload="(file) => { beforeUpload1(file, 'id', 'workingRelatedRarties/4') }"
                                                :show-upload-list="true"
                                                :max-size="10240"
                                                multiple
                                                type="drag"
                                                :action="fileUrl">
                                            <div style="padding: 10px">
                                                <Icon type="ios-cloud-upload" size="45" style="color: #3399ff"></Icon>
                                                <p>点击将文件拖拽到这里上传</p>
                                                <!--<span style="font-size:8px;color: #797a64">支持扩展名：.rar .zip .doc .docx .pdf...</span>-->
                                            </div>
                                        </Upload>
                                    </div>
                                    <div v-show="dataToView.idFiles.filter(t=>t.field==='4').length>0" v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='4')" :key='item'>
                                        <a @click="downloadFiles(item,index)">{{ item.fileName }}</a>
                                        <Button type="text" icon="md-trash" @click="removeFile1(item.id, 'id', 'workingRelatedRarties/4')" style="margin-left: 5px;margin-bottom: 3px"/>
                                        <Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>
                                        <!--<Progress  v-show="filePercentVisible[index]" :percent="filePercent[index]"></Progress>-->
                                    </div>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label='第三方驻地是否租赁：' prop='ifLease'>
                                    <div v-if="mode === 'view'">{{ dataToView.ifLease }}</div>
                                    <!--<Input v-else class='query-form-el' placeholder="请填写第三方驻地是否租赁" type='text' v-model='dataToView.ifLease'></Input>-->
                                    <Select v-else v-model='dataToView.ifLease' placeholder="请选择第三方驻地是否租赁"  class='query-form-el'>
                                        <Option value="是">是</Option>
                                        <Option value="否">否</Option>
                                    </Select>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label='实际完成日期：' prop='actualFinishingDate'>
                                    <div v-if="mode === 'view'">{{renderViewDate( dataToView.actualFinishingDate) }}</div>
                                    <DatePicker v-else class="query-form-el" :options="options" placeholder="请选择实际完成日期" v-model='dataToView.actualFinishingDate' ></DatePicker>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="23">
                                <FormItem v-if="mode === 'view'" label="资质文件：">
                                    <div v-show="dataToView.idFiles.filter(t=>t.field==='5').length>0" v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='5')">
                                        <a @click="downloadFiles(item,index)"><span style="color: #3399ff;margin-left: 5px">{{ item.fileName }}</span></a>
                                        <Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>
                                    </div>
                                </FormItem>
                                <FormItem v-else label="资质文件：" prop="idFiles">
                                    <div>
                                        <Upload ref="upload"
                                                :before-upload="(file) => { beforeUpload1(file, 'id', 'workingRelatedRarties/5') }"
                                                :show-upload-list="true"
                                                :max-size="10240"
                                                multiple
                                                type="drag"
                                                :action="fileUrl">
                                            <div style="padding: 10px">
                                                <Icon type="ios-cloud-upload" size="45" style="color: #3399ff"></Icon>
                                                <p>点击将文件拖拽到这里上传</p>
                                                <!--<span style="font-size:8px;color: #797a64">支持扩展名：.rar .zip .doc .docx .pdf...</span>-->
                                            </div>
                                        </Upload>
                                    </div>
                                    <div v-show="dataToView.idFiles.filter(t=>t.field==='5').length>0" v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='5')" :key='item'>
                                        <a @click="downloadFiles(item,index)">{{ item.fileName }}</a>
                                        <Button type="text" icon="md-trash" @click="removeFile1(item.id, 'id', 'workingRelatedRarties/5')" style="margin-left: 5px;margin-bottom: 3px"/>
                                        <Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>
                                        <!--<Progress  v-show="filePercentVisible[index]" :percent="filePercent[index]"></Progress>-->
                                    </div>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="23">
                                <FormItem v-if="mode === 'view'" label="合同附件：">
                                    <div v-show="dataToView.idFiles.filter(t=>t.field==='6').length>0" v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='6')">
                                        <a @click="downloadFiles(item,index)"><span style="color: #3399ff;margin-left: 5px">{{ item.fileName }}</span></a>
                                        <Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>
                                    </div>
                                </FormItem>
                                <FormItem v-else label="合同附件：" prop="idFiles" >
                                    <div>
                                        <Upload ref="upload"
                                                :before-upload="(file) => { beforeUpload1(file, 'id', 'workingRelatedRarties/6') }"
                                                :show-upload-list="true"
                                                :max-size="10240"
                                                multiple
                                                type="drag"
                                                :action="fileUrl">
                                            <div style="padding: 10px">
                                                <Icon type="ios-cloud-upload" size="45" style="color: #3399ff"></Icon>
                                                <p>点击将文件拖拽到这里上传</p>
                                                <!--<span style="font-size:8px;color: #797a64">支持扩展名：.rar .zip .doc .docx .pdf...</span>-->
                                            </div>
                                        </Upload>
                                    </div>
                                    <div v-show="dataToView.idFiles.filter(t=>t.field==='6').length>0" v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='6')" :key='item'>
                                        <a @click="downloadFiles(item,index)">{{ item.fileName }}</a>
                                        <Button type="text" icon="md-trash" @click="removeFile1(item.id, 'id', 'workingRelatedRarties/6')" style="margin-left: 5px;margin-bottom: 3px"/>
                                        <Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>
                                        <!--<Progress  v-show="filePercentVisible[index]" :percent="filePercent[index]"></Progress>-->
                                    </div>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="23">
                                <FormItem v-if="mode === 'view'" label="安全环保协议：">
                                    <div v-show="dataToView.idFiles.filter(t=>t.field==='7').length>0" v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='7')">
                                        <a @click="downloadFiles(item,index)"><span style="color: #3399ff;margin-left: 5px">{{ item.fileName }}</span></a>
                                        <Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>
                                    </div>
                                </FormItem>
                                <FormItem v-else label="安全环保协议：" prop="idFiles" >
                                    <div>
                                        <Upload ref="upload"
                                                :before-upload="(file) => { beforeUpload1(file, 'id', 'workingRelatedRarties/7') }"
                                                :show-upload-list="true"
                                                :max-size="10240"
                                                multiple
                                                type="drag"
                                                :action="fileUrl">
                                            <div style="padding: 10px">
                                                <Icon type="ios-cloud-upload" size="45" style="color: #3399ff"></Icon>
                                                <p>点击将文件拖拽到这里上传</p>
                                                <!--<span style="font-size:8px;color: #797a64">支持扩展名：.rar .zip .doc .docx .pdf...</span>-->
                                            </div>
                                        </Upload>
                                    </div>
                                    <div v-show="dataToView.idFiles.filter(t=>t.field==='7').length>0" v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='7')" :key='item'>
                                        <a @click="downloadFiles(item,index)">{{ item.fileName }}</a>
                                        <Button type="text" icon="md-trash" @click="removeFile1(item.id, 'id', 'workingRelatedRarties/7')" style="margin-left: 5px;margin-bottom: 3px"/>
                                        <Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>
                                        <!--<Progress  v-show="filePercentVisible[index]" :percent="filePercent[index]"></Progress>-->
                                    </div>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="23">
                                <FormItem v-if="mode === 'view'" label="施工方案：">
                                    <div v-show="dataToView.idFiles.filter(t=>t.field==='8').length>0" v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='8')">
                                        <a @click="downloadFiles(item,index)"><span style="color: #3399ff;margin-left: 5px">{{ item.fileName }}</span></a>
                                        <Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>
                                    </div>
                                </FormItem>
                                <FormItem v-else label="施工方案：" prop="idFiles" >
                                    <div>
                                        <Upload ref="upload"
                                                :before-upload="(file) => { beforeUpload1(file, 'id', 'workingRelatedRarties/8') }"
                                                :show-upload-list="true"
                                                :max-size="10240"
                                                multiple
                                                type="drag"
                                                :action="fileUrl">
                                            <div style="padding: 10px">
                                                <Icon type="ios-cloud-upload" size="45" style="color: #3399ff"></Icon>
                                                <p>点击将文件拖拽到这里上传</p>
                                                <!--<span style="font-size:8px;color: #797a64">支持扩展名：.rar .zip .doc .docx .pdf...</span>-->
                                            </div>
                                        </Upload>
                                    </div>
                                    <div v-show="dataToView.idFiles.filter(t=>t.field==='8').length>0" v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='8')" :key='item'>
                                        <a @click="downloadFiles(item,index)">{{ item.fileName }}</a>
                                        <Button type="text" icon="md-trash" @click="removeFile1(item.id, 'id', 'workingRelatedRarties/8')" style="margin-left: 5px;margin-bottom: 3px"/>
                                        <Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>
                                        <!--<Progress  v-show="filePercentVisible[index]" :percent="filePercent[index]"></Progress>-->
                                    </div>
                                </FormItem>
                            </Col>
                        </Row>
                        <!--<Row type="flex" justify="space-around" class="code-row-bg">-->
                            <!--<Col span="23">-->
                                <!--<FormItem v-if="mode === 'view'" label="安全交底与告知：">-->
                                    <!--<div v-show="dataToView.idFiles.filter(t=>t.field==='9').length>0" v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='9')">-->
                                        <!--<a @click="downloadFiles(item,index)"><span style="color: #3399ff;margin-left: 5px">{{ item.fileName }}</span></a>-->
                                        <!--<Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>-->
                                    <!--</div>-->
                                <!--</FormItem>-->
                                <!--<FormItem v-else label="安全交底与告知：" >-->
                                    <!--<div>-->
                                        <!--<Upload ref="upload"-->
                                                <!--:before-upload="(file) => { beforeUpload1(file, 'id', 'workingRelatedRarties/9') }"-->
                                                <!--:show-upload-list="true"-->
                                                <!--:max-size="10240"-->
                                                <!--multiple-->
                                                <!--type="drag"-->
                                                <!--:action="fileUrl">-->
                                            <!--<div style="padding: 10px">-->
                                                <!--<Icon type="ios-cloud-upload" size="45" style="color: #3399ff"></Icon>-->
                                                <!--<p>点击将文件拖拽到这里上传</p>-->
                                                <!--&lt;!&ndash;<span style="font-size:8px;color: #797a64">支持扩展名：.rar .zip .doc .docx .pdf...</span>&ndash;&gt;-->
                                            <!--</div>-->
                                        <!--</Upload>-->
                                    <!--</div>-->
                                    <!--<div v-show="dataToView.idFiles.filter(t=>t.field==='9').length>0" v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='9')" :key='item'>-->
                                        <!--<a @click="downloadFiles(item,index)">{{ item.fileName }}</a>-->
                                        <!--<Button type="text" icon="md-trash" @click="removeFile1(item.id, 'id', 'workingRelatedRarties/9')" style="margin-left: 5px;margin-bottom: 3px"/>-->
                                        <!--<Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>-->
                                        <!--&lt;!&ndash;<Progress  v-show="filePercentVisible[index]" :percent="filePercent[index]"></Progress>&ndash;&gt;-->
                                    <!--</div>-->
                                <!--</FormItem>-->
                            <!--</Col>-->
                        <!--</Row>-->
                        <!--<Row type="flex" justify="space-around" class="code-row-bg">-->
                            <!--<Col span="23">-->
                                <!--<FormItem v-if="mode === 'view'" label="培训资料：">-->
                                    <!--<div v-show="dataToView.idFiles.filter(t=>t.field==='10').length>0" v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='10')">-->
                                        <!--<a @click="downloadFiles(item,index)"><span style="color: #3399ff;margin-left: 5px">{{ item.fileName }}</span></a>-->
                                        <!--<Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>-->
                                    <!--</div>-->
                                <!--</FormItem>-->
                                <!--<FormItem v-else label="培训资料：" >-->
                                    <!--<div>-->
                                        <!--<Upload ref="upload"-->
                                                <!--:before-upload="(file) => { beforeUpload1(file, 'id', 'workingRelatedRarties/10') }"-->
                                                <!--:show-upload-list="true"-->
                                                <!--:max-size="10240"-->
                                                <!--multiple-->
                                                <!--type="drag"-->
                                                <!--:action="fileUrl">-->
                                            <!--<div style="padding: 10px">-->
                                                <!--<Icon type="ios-cloud-upload" size="45" style="color: #3399ff"></Icon>-->
                                                <!--<p>点击将文件拖拽到这里上传</p>-->
                                                <!--&lt;!&ndash;<span style="font-size:8px;color: #797a64">支持扩展名：.rar .zip .doc .docx .pdf...</span>&ndash;&gt;-->
                                            <!--</div>-->
                                        <!--</Upload>-->
                                    <!--</div>-->
                                    <!--<div v-show="dataToView.idFiles.filter(t=>t.field==='10').length>0" v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='10')" :key='item'>-->
                                        <!--<a @click="downloadFiles(item,index)">{{ item.fileName }}</a>-->
                                        <!--<Button type="text" icon="md-trash" @click="removeFile1(item.id, 'id', 'workingRelatedRarties/10')" style="margin-left: 5px;margin-bottom: 3px"/>-->
                                        <!--<Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>-->
                                        <!--&lt;!&ndash;<Progress  v-show="filePercentVisible[index]" :percent="filePercent[index]"></Progress>&ndash;&gt;-->
                                    <!--</div>-->
                                <!--</FormItem>-->
                            <!--</Col>-->
                        <!--</Row>-->
												<Row type="flex" justify="space-around" class="code-row-bg">
												    <Col span="23">
												        <FormItem v-if="mode === 'view'" label="安全保障方案：">
												            <div v-show="dataToView.idFiles.filter(t=>t.field==='12').length>0" v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='12')">
												                <a @click="downloadFiles(item,index)"><span style="color: #3399ff;margin-left: 5px">{{ item.fileName }}</span></a>
												                <Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>
												            </div>
												        </FormItem>
												        <FormItem v-else label="安全保障方案：" prop="idFiles" >
												            <div>
												                <Upload ref="upload"
												                        :before-upload="(file) => { beforeUpload1(file, 'id', 'workingRelatedRarties/12') }"
												                        :show-upload-list="true"
												                        :max-size="10240"
												                        multiple
												                        type="drag"
												                        :action="fileUrl">
												                    <div style="padding: 10px">
												                        <Icon type="ios-cloud-upload" size="45" style="color: #3399ff"></Icon>
												                        <p>点击将文件拖拽到这里上传</p>
												                        <!--<span style="font-size:8px;color: #797a64">支持扩展名：.rar .zip .doc .docx .pdf...</span>-->
												                    </div>
												                </Upload>
												            </div>
												            <div v-show="dataToView.idFiles.filter(t=>t.field==='12').length>0" v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='12')" :key='item'>
												                <a @click="downloadFiles(item,index)">{{ item.fileName }}</a>
												                <Button type="text" icon="md-trash" @click="removeFile1(item.id, 'id', 'workingRelatedRarties/12')" style="margin-left: 5px;margin-bottom: 3px"/>
												                <Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>
												                <!--<Progress  v-show="filePercentVisible[index]" :percent="filePercent[index]"></Progress>-->
												            </div>
												        </FormItem>
												    </Col>
												</Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="23">
                                <FormItem v-if="mode === 'view'" label="其他：">
                                    <div v-show="dataToView.idFiles.filter(t=>t.field==='11').length>0" v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='11')">
                                        <a @click="downloadFiles(item,index)"><span style="color: #3399ff;margin-left: 5px">{{ item.fileName }}</span></a>
                                        <Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>
                                    </div>
                                </FormItem>
                                <FormItem v-else label="其他：" >
                                    <div>
                                        <Upload ref="upload"
                                                :before-upload="(file) => { beforeUpload1(file, 'id', 'workingRelatedRarties/11') }"
                                                :show-upload-list="true"
                                                :max-size="10240"
                                                multiple
                                                type="drag"
                                                :action="fileUrl">
                                            <div style="padding: 10px">
                                                <Icon type="ios-cloud-upload" size="45" style="color: #3399ff"></Icon>
                                                <p>点击将文件拖拽到这里上传</p>
                                                <!--<span style="font-size:8px;color: #797a64">支持扩展名：.rar .zip .doc .docx .pdf...</span>-->
                                            </div>
                                        </Upload>
                                    </div>
                                    <div v-show="dataToView.idFiles.filter(t=>t.field==='11').length>0" v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='11')" :key='item'>
                                        <a @click="downloadFiles(item,index)">{{ item.fileName }}</a>
                                        <Button type="text" icon="md-trash" @click="removeFile1(item.id, 'id', 'workingRelatedRarties/11')" style="margin-left: 5px;margin-bottom: 3px"/>
                                        <Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>
                                        <!--<Progress  v-show="filePercentVisible[index]" :percent="filePercent[index]"></Progress>-->
                                    </div>
                                </FormItem>
                            </Col>
                        </Row>
                        <!--<Row type="flex" justify="space-around" class="code-row-bg">-->
                            <!--<Col span="11">-->
                                <!--<FormItem label='作业状态：' prop='workStatus'>-->
                                    <!--<div v-if="mode === 'view'">{{ dataToView.workStatus }}</div>-->
                                    <!--<Input v-else class='query-form-el' placeholder="请填写作业状态" type='text' v-model='dataToView.workStatus'></Input>-->
                                <!--</FormItem>-->
                            <!--</Col>-->
                        <!--</Row>-->
												<Row type="flex" justify="space-around" class="code-row-bg">
												    <Col span="23">
												        <FormItem label='清退理由：' prop='reasonsDismissal'>
												            <div v-if="mode === 'view'">{{ dataToView.reasonsDismissal }}</div>
												            <Input v-else class='query-form-el' placeholder="请填写清退理由" type='text' v-model='dataToView.reasonsDismissal'></Input>
												        </FormItem>
												    </Col>
												</Row>

                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label='填报人：' prop='createUserName'>
                                    <div v-if="mode === 'view'">{{ dataToView.createUserName }}</div>
                                    <Input v-else class='query-form-el' placeholder="请填写填报人" type='text' readonly
                                           v-model='dataToView.createUserName'></Input>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label='填报时间：' prop='createDate'>
                                    <div v-if="mode === 'view'">{{ renderViewDate(dataToView.createDate) }}</div>
                                    <DatePicker v-else class="query-form-el" placeholder="请选择填报时间" readonly
                                                v-model='dataToView.createDate'></DatePicker>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label='填报人手机号：' prop='registrantPhone'>
                                    <div v-if="mode === 'view'">{{ dataToView.registrantPhone }}</div>
                                    <Input v-else class='query-form-el' placeholder="请填写填报人手机号" type='text'
                                           v-model='dataToView.registrantPhone'></Input>
                                </FormItem>
                            </Col>
                            <Col span="11"></Col>
                        </Row>
                    </Form>
                </Col>
                <Modal :mask-closable="false" :transfer=false footer-hide v-model="relatedPartiesModel" :width=900 title="相关方台账" @on-cancel="relatedPartiesModel=false">
                    <interested-parties-book v-if="relatedPartiesModel" v-show="relatedPartiesModel" :modelSelect="relatedPartiesModel"
                              :companyId="dataToView.companyId"  @getSelectModelData='getSelectCount'></interested-parties-book>
                </Modal>
            </Row>
            <div slot="footer">
                <Button v-if="mode != 'view'" type="primary" class='ivu-btn-save' @click="submit('dialogForm')">确定
                </Button>
                <Button v-if="mode != 'view'" type="primary" class='ivu-btn-cancel' @click="handleCancel">取消</Button>
                <Button v-if="mode === 'view'" class='ivu-btn-save' @click="dialogShow=false">关闭</Button>
            </div>
        </Modal>

    </Layout>
</template>

<script>
    import {Api} from '@/api/index.js'
    import pageCommonFunction from '@/components/pageCommonFunction.js'
    import {sessionStorage} from '@/common/cacheUtils.js';
    var cascaderDom = () => import('@/components/cascader-dom.vue');
    import interestedPartiesBook from './interestedPartiesBook'

    export default {
        components: {cascaderDom, interestedPartiesBook},
        props: ['companyId', 'modelSearch'],
        data() {
            return {
                ...this.createCommonDataField(),
                columns1: [
                    {title: '序号', width: 70, fixed: 'left', align: 'center', render: !this.modelSearch? this.indexColumnsRenderSum :this.indexColumnsRender},
                    { key:'companyName',title: '单位名称',  align: 'center', minWidth: 180, },
                    { key:'relatedPartiesName',title: '相关方名称',  align: 'center', minWidth: 180,  },
										{minWidth: 120, title: '相关方负责人', align: 'center', key: 'constructionDirector',},
										{minWidth: 120, title: '相关方负责人电话', align: 'center', key: 'constructionDirectorPhone',},
                    { key:'ifConcreteClean',title: '是否清库',  align: 'center', minWidth: 100, },
                    { key:'workingMatters',title: '作业事项',  align: 'center', minWidth: 120, tooltip:true },
                    { key:'qualificationReviewDepartment',title: '资质审核部门',  align: 'center', minWidth: 120,  },
                    { key:'qualificationReviewDepartmentUser',title: '资质审核部门责任人',  align: 'center', minWidth: 120,  },
                    { key:'territorialCompetentDepartment',title: '属地主管部门',  align: 'center', minWidth: 120,  },
                    { key:'territorialCompetentDepartmentUser',title: '属地主管部门责任人',  align: 'center', minWidth: 120,  },
                    // { key:'supervisionDepartment',title: '安全环保监督部门',  align: 'center', minWidth: 120,  },
                    { key:'supervisionDepartmentUser',title: '安全环保监督部门责任人',  align: 'center', minWidth: 120,  },
                    { key:'businessCompetentDepartment',title: '业务主管部门',  align: 'center', minWidth: 120,  },
                    { key:'businessCompetentDepartmentUser',title: '业务主管部门责任人',  align: 'center', minWidth: 120,  },
                    { key:'startTime',title: '开始时间',  align: 'center', minWidth: 120, sortable: "custom", render: this.renderCellDate },
                    { key:'playEndTime',title: '计划结束时间',  align: 'center', minWidth: 120, sortable: "custom", render: this.renderCellDate },
                    {minWidth: 120, title: '特种作业人员上岗证数量', align: 'center', key: 'workLicenseNumber',},
                    {minWidth: 120, title: '特种作业人员数量', align: 'center', key: 'workerNumber',},
										{ key:'ifHazardousWork',title: '是否涉及危险作业',  align: 'center', minWidth: 120,  },
                    { key:'hazardousWorkItemName',title: '危险作业项目',  align: 'center', minWidth: 120, tooltip:true },
                    { key:'ifSupervisor',title: '是否涉及监理单位',  align: 'center', minWidth: 120,  },
                    { key:'supervisorName',title: '监理单位名称',  align: 'center', minWidth: 120,  },
                    { key:'ifResident',title: '是否住场',  align: 'center', minWidth: 120,  },
                    { key:'ifApprove',title: '是否企业已审批',  align: 'center', minWidth: 120,
                        render:(h, params) =>{return h('span', params.row.ifApprove=='0'?'未审批':params.row.ifApprove=='1'?'审批中':params.row.ifApprove=='2'?'已审批':'')}},
                    { key:'reasonsDismissal',title: '清退理由',  align: 'center', minWidth: 120, tooltip:true },
                    { key:'ifBringControl',title: '相关方日常检查是否纳入管理范围',  align: 'center', minWidth: 120,  },
                    { key:'ifJoinMeeting',title: '是否参加属地班组安全例会',  align: 'center', minWidth: 120,  },
                    { key:'ifLease',title: '第三方驻地是否租赁',  align: 'center', minWidth: 120,  },
                    { key:'actualFinishingDate',title: '实际完成日期',  align: 'center', sortable: "custom", minWidth: 120,  render: this.renderCellDate },
                    { key:'workStatus',title: '作业状态',fixed: 'left',  align: 'center', minWidth: 90,
                        render:(h, params) =>{return h('span', params.row.workStatus=='3'?'计划中':params.row.workStatus=='0'?'进行中':params.row.workStatus=='1'?'已完成':params.row.workStatus=='2'?'延期完成':'')}},
                    {key: 'createDate', title: '填报时间', align: 'center', sortable: "custom", minWidth: 120,render: this.renderCellDate},
                    { key:'belongOrgName',title: '所属二级集团',  align: 'center', minWidth: 180, },
                    !this.modelSearch?this.getActionColumns((params) => {return params.row.id === '-1';}):
                        {title: '操作', key: 'action', fixed: 'right', width: 80, align: 'center', render: (h, params) => {
                                return h('div', [
                                    h('A', {
                                        props: { type: 'primary', size: 'small' },
                                        style: { fontSize: '12px' },
                                        on: {click: () => {this.checkSave(params.row);}}
                                    }, '选择'),
                                ])}},
                ],
                show:true,
                ruleCustom: {
									workLicenseNumber: [ { pattern: /^([0-9][0-9]*)?$/, required: true, message: ' ', trigger: 'change',type:'number'}],
									workerNumber: [ { pattern: /^([0-9][0-9]*)?$/, required: true, message: ' ', trigger: 'change',type:'number'}],
                    storageName: [ { required: true, message: '请填写清理储库名称', trigger: 'change' } ],
                    storageMount: [ { pattern: /^([0-9][0-9]*)?$/, required: true, message: '请填写储库数量,必须为数字', trigger: 'change, blur',type: 'number'}],
                    cleanMethod: [ { required: true, message: '请选择清库方式', trigger: 'change' }],
                    belongOrgId: [ { required: true, message: '请填写所属二级集团', trigger: 'change',}],
                    companyId: [ { required: true, message: '请填写单位名称', trigger: 'change',}],
                    relatedPartiesId: [ { required: true, message: '请填写相关方名称', trigger: 'change',}],
                    workingMatters: [ { required: true, message: '请填写作业事项', trigger: 'change',}],
                    qualificationReviewDepartment: [ { required: true, message: '请填写资质审核部门', trigger: 'change',}],
                    qualificationReviewDepartmentUser: [ { required: true, message: '请填写资质审核部门责任人', trigger: 'change',}],
                    territorialCompetentDepartment: [ { required: true, message: '请填写属地主管部门', trigger: 'change',}],
                    territorialCompetentDepartmentUser: [ { required: true, message: '请填写属地主管部门责任人', trigger: 'change',}],
                    // supervisionDepartment: [ { required: true, message: '请填写安全环保监督部门', trigger: 'change',}],
                    supervisionDepartmentUser: [ { required: true, message: '请填写安全环保监督部门责任人', trigger: 'change',}],
                    businessCompetentDepartment: [ { required: true, message: '请填写业务主管部门', trigger: 'change',}],
                    businessCompetentDepartmentUser: [ { required: true, message: '请填写业务主管部门责任人', trigger: 'change',}],
                    startTime: [ { required: true, message: '请填写开始时间', trigger: 'change',type:'date'}],
                    playEndTime: [ { required: true, message: '请填写计划结束时间', trigger: 'change',type:'date'}],
                    ifHazardousWork: [ { required: true, message: '请填写是否涉及危险作业', trigger: 'change',}],
                    hazardousWorkItemArr: [ {
                        validator: (rule, value, callback) => {
                            if (this.dataToView.hazardousWorkItemArr.length < 1) {
                                callback(' ')
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],
                    ifSupervisor: [ { required: true, message: '请填写是否涉及监理单位', trigger: 'change',}],
                    supervisorName: [ { required: true, message: '请填写监理单位名称', trigger: 'change',}],
                    ifResident: [ { required: true, message: '请填写是否住场', trigger: 'change',}],
                    ifApprove: [ { required: true, message: '请填写是否企业已审批', trigger: 'change',}],
                    // reasonsDismissal: [ { required: true, message: '请填写清退理由', trigger: 'change',}],
                    ifBringControl: [ { required: true, message: '请填写相关方日常检查是否纳入管理范围', trigger: 'change',}],
                    ifJoinMeeting: [ { required: true, message: '请填写是否参加属地班组安全例会', trigger: 'change',}],
                    ifLease: [ { required: true, message: '请填写第三方驻地是否租赁', trigger: 'change',}],
                    // actualFinishingDate: [ { required: true, message: '请填写实际完成日期', trigger: 'change',type:'date'}],
                    // workStatus: [ { required: true, message: '请填写作业状态', trigger: 'change',}],

                    createUserName: [{required: true, message: '请填写填报人', trigger: 'change',}],
                    createDate: [{required: true, message: '请填写填报时间', trigger: 'change', type: 'date'}],
										constructionDirector: [{required: true, message: '请填写相关方负责人', trigger: 'change',}],
										constructionDirectorPhone: [{
										    validator: (rule, value, callback) => {
										        if(!(/^1[3456789]\d{9}$/.test(this.dataToView.constructionDirectorPhone))){
										            callback(' ');
										            // this.$Message.error("请填写有效的的手机号")
										        } else {
										            callback()
										        }
										    },
										    required: true,
										    trigger: 'blur'
										}],
                    registrantPhone: [{
                        validator: (rule, value, callback) => {
                            if (!(/^1[3456789]\d{9}$/.test(this.dataToView.registrantPhone))) {
                                callback(' ');
                                // this.$Message.error("请填写有效的的手机号")
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'blur'
                    }],
                    idFiles: [{
                        validator: (rule, value, callback) => {
                            if ((this.dataToView.ifHazardousWork === '是'&&this.dataToView.idFiles.filter(t=>t.field==='1').length < 1)||
                                (this.dataToView.ifApprove === '3'&&this.dataToView.idFiles.filter(t=>t.field==='2').length < 1)||
                                (this.dataToView.ifBringControl === '是'&&this.dataToView.idFiles.filter(t=>t.field==='3').length < 1)||
                                (this.dataToView.ifJoinMeeting === '是'&&this.dataToView.idFiles.filter(t=>t.field==='4').length < 1)||
                                this.dataToView.idFiles.filter(t=>t.field==='5').length < 1||
                                this.dataToView.idFiles.filter(t=>t.field==='6').length < 1||
                                this.dataToView.idFiles.filter(t=>t.field==='7').length < 1||
                                this.dataToView.idFiles.filter(t=>t.field==='8').length < 1||
                                this.dataToView.idFiles.filter(t=>t.field==='12').length < 1) {
                                callback('附件必须上传')
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }]
                },
                tableHeight: 10,
                // api
                queryUrl: Api.queryWorkingRelatedRarties,
                exportUrl: Api.exportWorkingRelatedRarties,
                deleteUrl: Api.deleteWorkingRelatedRarties,
                getUrl: Api.getWorkingRelatedRarties,
                updateUrl: Api.updateWorkingRelatedRarties,
                saveUrl: Api.saveWorkingRelatedRarties,
                uploadUrl: Api.uploadMongoFile,
                currentUser: JSON.parse(sessionStorage('userId').get('userId')),

                relatedPartiesModel:false,
                dictMap:{},
                twoLevel:[],
                options: {
                    disabledDate (date) {
                        return date && date.valueOf() >= new Date();
                    }
                },
            }
        },
        mounted() {
            this.setTableHeight(193);
            this.query();
            this.selectSecGroupNames()
            // let _this = this
            // this.gDic(Api.queryCodeDetailBySortId + "/ptw-100001", function (result) {
            //     _this.dictMap.hazardousWorkItems = result;
            // });
            this.$http.get(Api.queryDictBycode+"EC-000002,CCP-000001",{}).then((res)=>{
                this.dictMap = {
                    'hazardousWorkItems': res.data.data['EC-000002'],
                    'cleanMethodList': res.data.data['CCP-000001']
                }
            }).catch(e => {
                this.$Message.error("数据字典获取失败")
            });
        },
        methods: {
            ...pageCommonFunction,
            checkSave(row){
                this.$emit('getSelectModelData',row);
            },

            getSelectCount(row) {
                this.$set(this.dataToView,'relatedPartiesId', row.bookId)
                this.dataToView.relatedPartiesName = row.contractorName;
                this.relatedPartiesModel = false;
            },
            selectSecGroupNames(){
                this.$http.get(Api.quqeryTwoOrgInfo).then(res => {
                    this.twoLevel=res.data.data
                }).catch(e => {
                })
            },
            belongChange(value) {
                this.$set(this.dataToView,'belongOrgId',value.value)
                this.$set(this.dataToView,'belongOrgName',value.label)
                this.dataToView.companyId = null
                this.dataToView.companyName = null
                this.$refs.orgCascader.resetCurrentOrg();
                this.show = false;
                setTimeout(() => {
                    this.show = true
                }, 0)
            },
            deleteData(params) {
                this.deleteDateAjax(params);
            },
            query() {
                if (this.companyId) {
                    this.dataToQuery.companyId = this.companyId
                    // this.dataToQuery.ifReport = '0'
                }
                this.queryAjax();
            },

            submit(name) {
                if (this.dataToView.hazardousWorkItemArr.length>0) {
                    this.dataToView.hazardousWorkItems = this.dataToView.hazardousWorkItemArr.join(',')
                }
                if (this.dataToView.ifConcreteClean=='否'){
                    this.dataToView.storageMount =null
                    this.dataToView.cleanMethod =null
                    this.dataToView.storageName=null
                }
                this.submitAjax(name);
            },
            async beforeEditDialogOpen(data) {
                data.row.hazardousWorkItemArr = data.row.hazardousWorkItems?data.row.hazardousWorkItems.split(','):[]
            },
            createEmptyDataToAdd() {
                return {
                    createDate: new Date(),
                    createUserId: this.currentUser.userId,
                    createUserName: this.currentUser.userName,
                    id: this.get_uuid(),
                    idFiles: [],
                    hazardousWorkItemArr:[],
                    ifConcreteClean:'否',
										workLicenseNumber: 0,
										workerNumber:0
                }
            },
            async afterDataToViewInit() {
                await this.getFiles1('id', 'workingRelatedRarties');
            },
        },
        watch: {},
    }
</script>

<style lang='css' scoped>
    .ivu-form-item {
        padding-right: 20px;
    }

    .query-form-el, .ivu-date-picker, .ivu-input-wrapper {
        width: 100%;
    }

    .demo-upload-list{
        display: inline-block;
        width: 70px;
        height: 70px;
        text-align: center;
        line-height: 70px;
        border: 1px solid transparent;
        border-radius: 4px;
        overflow: hidden;
        background: #fff;
        position: relative;
        box-shadow: 0 1px 1px rgba(0,0,0,.2);
        margin-right: 4px;
    }
    .demo-upload-list img{
        width: 100%;
        height: 100%;
    }
    .demo-upload-list-cover{
        display: none;
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(0,0,0,.6);
    }
    .demo-upload-list:hover .demo-upload-list-cover{
        display: block;
    }
    .demo-upload-list-cover i{
        color: #fff;
        font-size: 20px;
        cursor: pointer;
        margin: 0 2px;
    }
</style>
